


ssize_t rio_writen(int fd, void *usrbuf,size_t n)
{
     size_t nleft=n; 
     ssize_t nwritten;
     char *bufp=uerbuf;

     while(nleft>0)
     {
       if((nwrritten=write(fd,bufp,nleft))<=0)
       {
           if(errno==EIMTR)
             nwritten=0;
           else
             return -1;
       }
       nleft-=nwritten;
       bufp+=nwrittrn;
    }
    return n;
}
